function pearson_similarity_matrix = getPearsonKernel(y)
    krnl = y * y';
    y = krnl / mean(diag(krnl));
    % Compute the Pearson correlation coefficient between rows
    [n, ~] = size(y);
    pearson_similarity_matrix = zeros(n);

    for i = 1:n
        for j = i:n
            if i ~= j
                a = y(i, :);
                b = y(j, :);
                mean_a = mean(a);
                mean_b = mean(b);

                numerator = sum((a - mean_a) .* (b - mean_b));
                denominator = sqrt(sum((a - mean_a).^2) * sum((b - mean_b).^2) + eps);  % Add a small value (eps) to avoid division by zero

                pearson_similarity_matrix(i, j) = numerator / denominator;
                pearson_similarity_matrix(j, i) = pearson_similarity_matrix(i, j);
            end
        end
    end
end
